<template>
  <div>
    <h2>入住时间轴</h2>
    <el-timeline>
      <el-timeline-item
          v-for="item in timeline"
          :key="item.id"
          :timestamp="item.time"
          :color="item.color">
        {{ item.title }}
      </el-timeline-item>
    </el-timeline>
  </div>
</template>

<script setup>
import { ref, onMounted } from 'vue'
import axios from '@/api/axios'

const timeline = ref([])

onMounted(async () => {
  const res = await axios.get('/elder/timeline')
  timeline.value = res.data
})
</script>
